﻿using UnityEngine;

namespace UIBinding
{
    public static class ColorUtils
    {
        public static Color GetColor(string rgb)
        {
            Color nowColor;
            ColorUtility.TryParseHtmlString(rgb, out nowColor);
            return nowColor;
        }

        public static string StringGetColor(string str, Color color)
        {
            return string.Format("<color={0}>{1}</color>", ColorUtility.ToHtmlStringRGBA(color), str);
        }

        public static string StringGetColor(string str, string color)
        {
            return string.Format("<color={0}>{1}</color>", color, str);
        }
    }
}